#include <coro/epoll.hpp>

namespace coro {

static const std::string epoll_unknown{"unknown"};

static const std::string epoll_op_read{"read"};
static const std::string epoll_op_write{"write"};
static const std::string epoll_op_read_write{"read_write"};

auto to_string(epoll_op op) -> const std::string& {
  switch (op) {
    case epoll_op::read:
      return epoll_op_read;
    case epoll_op::write:
      return epoll_op_write;
    case epoll_op::read_write:
      return epoll_op_read_write;
    default:
      return epoll_unknown;
  }
}

static const std::string epoll_status_event{"event"};
static const std::string epoll_status_timeout{"timeout"};
static const std::string epoll_status_error{"error"};
static const std::string epoll_status_closed{"closed"};

auto to_string(epoll_status status) -> const std::string& {
  switch (status) {
    case epoll_status::event:
      return epoll_status_event;
    case epoll_status::timeout:
      return epoll_status_timeout;
    case epoll_status::error:
      return epoll_status_error;
    case epoll_status::closed:
      return epoll_status_closed;
    default:
      return epoll_unknown;
  }
}

}  // namespace coro